package com.jzxiang.pickerview.data.source;

import com.jzxiang.pickerview.config.NumberConfig;

public class NumRepository implements NumDataSource {
    private NumberConfig numberConfig;
    private int mValueMin, mValuerMax, step;

    private boolean mIsMinNoRange, mIsMaxNoRange;

    public NumRepository(NumberConfig numberConfig) {
        this.numberConfig = numberConfig;
        mValueMin = numberConfig.mMinValue;
        mValuerMax = numberConfig.mMaxValue;
        this.step = numberConfig.step;
    }

    @Override
    public int getMinValue() {
        return mValueMin;
    }

    @Override
    public int getMaxValue() {
        return mValuerMax;
    }

    @Override
    public boolean isMinValue(int value) {
        if(value == mValueMin){
            return true;
        }
        return false;
    }

    @Override
    public int getDefaultValue() {
        return numberConfig.mDefValue;
    }

    @Override
    public void setUnit(String unit) {
        numberConfig.mUnit = unit;
    }

    @Override
    public int getStep() {
        return numberConfig.step;
    }


}
